# $Id$
# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Maintainer: Antonio Rojas <arojas@archlinux.org>
# Contributor: Andrea Scarpino <andrea@archlinux.org>

pkgbase=plasma-desktop
pkgname=(plasma-desktop knetattach)
pkgver=5.10.95
pkgrel=1
pkgdesc='KDE Plasma Desktop'
arch=(i686 x86_64)
url='https://www.kde.org/workspaces/plasmadesktop/'
license=(LGPL)
source=("https://download.kde.org/unstable/plasma/$pkgver/$pkgname-$pkgver.tar.xz"{,.sig})
depends=(polkit-kde-agent libcanberra libxkbfile kmenuedit appstream-qt systemsettings ksysguard kpeople baloo qt5-graphicaleffects)
makedepends=(extra-cmake-modules kdoctools boost xf86-input-evdev xf86-input-synaptics xorg-server-devel
             libibus scim python kdesignerplugin)
groups=(plasma)
sha256sums=('14b747d5810c9357bef8278096fa1e36bdd3255c96377d1308f0e43f0c2387fc'
            'SKIP')
validpgpkeys=('2D1D5B0588357787DE9EE225EC94D18F7F05997E'  # Jonathan Riddell
              '348C8651206633FD983A8FC4DEACEA00075E1D76'  # KDE Neon
              'D07BD8662C56CB291B316EB2F5675605C74E02CF') # David Edmundson

prepare() {
  mkdir -p build
}

build() {
  cd build
  cmake ../$pkgname-$pkgver \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DKDE_INSTALL_LIBDIR=lib \
    -DKDE_INSTALL_LIBEXECDIR=lib \
    -DBUILD_TESTING=OFF
  make
}

package_plasma-desktop() {
  depends+=(knetattach)
  optdepends=('plasma-nm: Network manager applet'
            'powerdevil: power management'
            'ibus: kimpanel IBUS support'
            'scim: kimpanel SCIM support'
            'discover: manage applications installation from the launcher')
  conflicts=(kdebase-workspace kcm-touchpad-frameworks 'kdeplasma-addons<5.5.95' 'kactivities<5.19.0-3')
  replaces=(kcm-touchpad-frameworks)

  cd build
  make DESTDIR="$pkgdir" install

# Split knetattach
  rm "$pkgdir"/usr/{bin/knetattach,share/applications/org.kde.knetattach.desktop}
}

package_knetattach() {
  pkgdesc='Wizard which makes it easier to integrate network resources with the Plasma Desktop'
  depends=(kdelibs4support)

  cd build/knetattach
  make DESTDIR="$pkgdir" install
}
